package com.woniuxy.oldmanapi.service;

import com.woniuxy.oldmanapi.entity.Room;
import com.woniuxy.oldmanapi.mapper.RoomMapper;
import com.woniuxy.oldmanapi.vo.RoomVo;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoomService {

    @Autowired
    RoomMapper roomMapper;


    public List<RoomVo> findRooms(int id) {
        List<RoomVo> RoomList = roomMapper.selectById(id);
        return RoomList;
    }

    public int add(Room room) {
        return roomMapper.insert(room);
    }

    public void delete(int id) {
        roomMapper.deleteByPrimaryKey(id);
    }

    public void modify(Room room) {
        roomMapper.updateByPrimaryKey(room);
    }

    public Room selectOne(int id) {
        return roomMapper.selectByPrimaryKey(id);
    }

    public int findRoomNum(int id) {
        return roomMapper.selectNum(id);

    }


    public List<Room> selectByStoreyIdYSW(Integer buildingId, Integer storeyId) {
        return roomMapper.selectByStoreyIdYSW(buildingId, storeyId);
    }

    public List<Room> selectAllListYsw() {
        return roomMapper.selectAll();
    }
}
